home *** CD-ROM | disk | FTP | other *** search
- Path: vixen.cso.uiuc.edu!vjaswal
- From: vjaswal@ncsa.uiuc.edu (Vijendra Jaswal)
- Newsgroups: comp.lang.c++
- Subject: Re: STL Implementation
- Date: 2 Apr 1996 09:54:44 GMT
- Organization: National Center for Supercomputing Applications
- Message-ID: <4jqth4$el4@vixen.cso.uiuc.edu>
- References: <3158429C.242F@cgsd.com>
- NNTP-Posting-Host: xtc.ncsa.uiuc.edu
- X-Newsreader: TIN [version 1.2 PL2]
-
- : With STL I would like my class to have a point to a list
- : of objects in this class.
-
- : class foo
- : {
- : int a;
- : list<foo> * child_list;
- : };
-
- : But the pointer to the list<foo> can not be constructed
- : because foo isn't finished being defined yet.
-
-
- child_list is a pointer, so the compiler knows everything it needs
- to in order to construct it. But I think you need to forward declare
- the type of the pointer. For templates, you can forward declare as follows...
-
- template<class T> class list;
-
- I successfuly compiled a program with ONLY the following lines (with IRIX 5.3
- using Delta C++).
-
- // BEGIN
- template<class T> class list;
-
- class foo
- {
- int a;
- list<foo> * child_list;
- };
-
-
- main()
- {
- }
- // END
-
- --
- Vijendra Jaswal
- v-jaswal@uiuc.edu
- National Center for Supercomputing Applications
- University of Illinois, Urbana-Champaign
-